<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>客户管理</title>
    <script type="application/javascript">
        var contextPath = "<%=request.getContextPath()%>";
    </script>
    <script type="text/javascript" src="common/js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="apps_res/custmanage/css/custmanage.css">
    <script type="text/javascript" src="apps_res/custmanage/js/custmanage1.js"></script>
    <script type="text/javascript" src="apps_res/custmanage/js/custmanage.js"></script>
</head>

<body>
<div class="head">
    <div class="btn-class">
        <div class="btn-item-class">
            <a href="<%=request.getContextPath()%>/adminAction?method=logout">
                <div class="btn-div">
                    <div class="img-div">
                        <img class="home-img" src="common/images/out.png" />
                    </div>
                    <div class="text-div">退出</div>
                </div>
            </a>
        </div>
        <div class="btn-item-class">
            <a href="<%=request.getContextPath()%>/accountSet.jsp">
                <div class="btn-div">
                    <div class="img-div">
                        <img class="home-img" src="common/images/setting.png" />
                    </div>
                    <div class="text-div">${admin.realName}
                    </div>
                </div>
            </a>
        </div>
        <div class="btn-item-class">
            <a href="<%=request.getContextPath()%>/index.html">
                <div class="btn-div">
                    <div class="img-div">
                        <img class="home-img" src="common/images/home.png" />
                    </div>
                    <div class="text-div">首页</div>
                </div>
            </a>
        </div>
    </div>
    
    <!--公司名-->
    <div class="account-name-div">
        <span>
            APP发布系统
        </span>
    </div>
</div>
<%--app列表 start--%>

<div class="content">
    <div class="content-top">
        <%--按钮区--%>
        <div class="content-search">
            <a href="javascript:void(0);" onclick="newCust()">
                <div class="content-top-btn">新建</div>
            </a>
            <a href="javascript:void(0);" onclick="deleteCusts()">
                <div class="content-top-btn">删除</div>
            </a>
        </div>
        <%--客户管理文字--%>
        <div class="content-top-text-div">
            <img style="width:30px;height: 30px;vertical-align: middle"
                 src="apps_res/custmanage/images/custmanage.png" alt="">
            客户管理
        </div>
    </div>
    
    <div class="content-foot">
        <table cellspacing="1" id="custer-table">
            <tr class="table-title">
                <th style="width: 45px"></th>
                <th style="width: 120px">客户名称</th>
                <th style="width: 150px">Logo</th>
                <th style="width: 90px">最新版本</th>
                <th>描述</th>
                <th style="width: 200px;">操作</th>
            </tr>
            <c:forEach items="${appAndCustomerList}" var="appAndCustomer">
                <tr id="@fzc@_${appAndCustomer.id}" class="table-data">
                    <td>
                        <input type="checkbox" name="" value="${appAndCustomer.id}" />
                    </td>
                    <td>${appAndCustomer.custName}</td>
                    <td><img style="width: 100px;height: 50px;"
                             src="<c:url value="${appAndCustomer.logoUrl}" />" alt=""></td>
                    <td>${appAndCustomer.app_version}</td>
                    <td style="overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">${appAndCustomer.description}</td>
                    <td>
                        <a class=" edit-a" href="javascript:void(0)"
                           onclick="edit('${appAndCustomer.id}','${appAndCustomer.custName}','${appAndCustomer.logoUrl}','${appAndCustomer.appLogoUrl}');">
                            <img class="btn-img" src="common/images/edit.png">
                            <span class="btn-span edit-btn-text">编辑</span>
                        </a>
                        &nbsp;&nbsp;
                        <a href="javascript:void(0);" onclick="deleteCust('${appAndCustomer.id}')">
                            <img class="btn-img" src="common/images/delete.png">
                            <span class="btn-span delete-btn-text">删除</span>
                        </a>
                        &nbsp;&nbsp;
                        <a href="<c:url value="/appAction?method=queryApp&custId=${appAndCustomer.id}"/>">
                            <img class="btn-img" src="common/images/appmanage.png">
                            <span class="btn-span qr-btn-text">安装包</span>
                        </a>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>
</div>
<%--app列表 end--%>

<%--*********************弹窗*******--%>
<%--新建appdiv--%>
<div id="new_app_div">
    <%--遮光罩--%>
    <div id="gray"></div>
    <div class="popup" id="popup">
        <div class="top_nav" id='edit-app-nav'>
            <%--<div align="center">--%>
            <span>新建客户</span>
            <%--</div>--%>
        </div>
        <div class="min">
            <form name="formdata" id="formdata" target="ifr" method="post"
                  action="<%=request.getContextPath()%>/customerAction?method=addCust"
                  enctype="multipart/form-data">
                <fieldset>
                    <table id="new_table">
                        <tr>
                            <td width="100px"><label for="cust_name">客户名称</label></td>
                            <td><input type="text" name="cust_name" id="cust_name"
                                       class="text ui-widget-content ui-corner-all"></td>
                        </tr>
                        <tr>
                            <td width="100px"><label for="cust_logo">客户Logo</label></td>
                            <td>
                                <input type="file" name="cust_logo" id="cust_logo" value=""
                                       class="text ui-widget-content ui-corner-all">
                            </td>
                        </tr>
                        <tr>
                            <td width="100px"><label for="app_logo">AppLogo</label></td>
                            <td>
                                <input type="file" name="app_logo" id="app_logo" value=""
                                       class="text ui-widget-content ui-corner-all">
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </form>
            <%--进度条--%>
            <div id="new-parent">
                <div id="new-son"></div>
            </div>
            <div class="app-foot">
                <button class="hidden-div-btn new-cancel-btn" onclick="new_Cancel()">取消</button>
                <button class="hidden-div-btn new-submit-btn" onclick="new_OK()">确认</button>
            </div>
        </div>
    </div>
</div>

<%--********************************编辑app div****************--%>
<div id="edit-app-div">
    <div id="edit-app-gray"></div>
    <div class="popup" id="edit-popup">
        <div class="top_nav" id='top_nav'>
            <div align="center">
                <span>编辑客户</span>
            </div>
        </div>
        <div class="min">
            <form name="formdata1" id="formdata1" target="ifr" method="post"
                  action="<%=request.getContextPath()%>/customerAction?method=editCust"
                  enctype="multipart/form-data">
                <fieldset>
                    <table id="edit_table">
                        <input id="custId" type="hidden" name="custId" value="" />
                        <tr>
                            <td width="100px"><label for="cust_name1">客户名称</label></td>
                            <td><input type="text" name="cust_name1" id="cust_name1"
                                       class="text ui-widget-content ui-corner-all"></td>
                        </tr>
                        <tr>
                            <td width="100px"><label for="cust_logo1">客户Logo</label></td>
                            <td>
                                <input type="file" name="cust_logo1" id="cust_logo1" value=""
                                       class="text ui-widget-content ui-corner-all">
                            </td>
                        </tr>
                        <tr>
                            <td width="100px"><label for="app_logo1">AppLogo</label></td>
                            <td>
                                <input type="file" name="app_logo1" id="app_logo1" value=""
                                       class="text ui-widget-content ui-corner-all">
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </form>
            
            
            <div id="parent">
                <div id="son"></div>
            </div>
            <div class="app-foot">
                <button class="hidden-div-btn edit-cancel-btn" onclick="edit_cancel()">取消</button>
                <button class="hidden-div-btn edit-submit-btn" onclick="edit_OK()">确认</button>
            </div>
        </div>
    </div>

</div>
<%--****************************app二维码div********************--%>
<div id="qrcode-div">
    <div id="qrcode-gray"></div>
    <div class="popup" id="qrcode-popup">
        <div class="top_nav" id='qrcode-top_nav'>
            <div align="center">
                <span>二维码</span>
            </div>
        </div>
        <div class="min">
            <img id="qrcode_img" src="" alt="二维码" style="width: 250px;height: 250px;">
            <div class="qrcode-cancel-btn" onclick="closeQRcode()">
                关闭
            </div>
        </div>
    </div>
</div>
</body>
</html>